<?php
/**
 * Created by PhpStorm.
 * User: eugene
 * Date: 2018/3/15
 * Time: 10:00
 */

namespace App\Transformers;


class ParkingTransformer extends Transformer
{
    public function transform($item)
    {
        
        $golds = 0;
        if($item->type == 1){
            $golds = config('car.cfgStopLimit.upgradeParkingPrivate');
        }elseif($item->type == 2){
            $golds = config('car.cfgStopLimit.upgradeParkingCharge');
        }
        
        return [
            'id'=>$item->id,
            'type'=>$item->type_text,
            'parking_update_golds'=>$golds,
            'car'=>$item->record ? (new RecordTransformer())->singleData($item->record) : null,
        ];
    }
    
}